<?php

namespace App\Http\Controllers\home;

use App\Order;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class OrderController extends Controller
{
    // 保存订单
    public function save(Request $request){
        //return $request;
        for($i=0; $i<count($request->list); $i++){
             $order = new Order();
             $order->user_id = \Auth::id();
             $order->venue_id = $request->venue_id;
             $order->order_date = $request->order_date;
             $order->sn = $request->list[$i]["sn"];
             $order->time = $request->list[$i]["time"];
             $order->save();
        }

        return response()->json(["msg"=>"订单保存成功","code"=>200]);

    }

    // 测试api接口
    public function test(){
        return response()->json(["msg"=>"this is message","code"=>200]);
    }

}
